package com.ims.core.doc.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ims.common.annotation.Log;
import com.ims.common.core.controller.BaseController;
import com.ims.common.core.domain.AjaxResult;
import com.ims.common.enums.BusinessType;
import com.ims.core.doc.domain.TInInvoice84;
import com.ims.core.doc.service.ITInInvoice84Service;
import com.ims.common.utils.poi.ExcelUtil;
import com.ims.common.core.page.TableDataInfo;

/**
 * 84 电子发票（二手车销售统一发票）Controller
 *
 * @author IMS
 * @date 2024-11-26
 */
@RestController
@RequestMapping("/doc/ershouchexiaoshou")
public class TInInvoice84Controller extends BaseController
{
    @Autowired
    private ITInInvoice84Service tInInvoice84Service;

    /**
     * 查询84 电子发票（二手车销售统一发票）列表
     */
    @PreAuthorize("@ss.hasPermi('doc:ershouchexiaoshou:list')")
    @GetMapping("/list")
    public TableDataInfo list(TInInvoice84 tInInvoice84)
    {
        startPage();
        List<TInInvoice84> list = tInInvoice84Service.selectTInInvoice84List(tInInvoice84);
        return getDataTable(list);
    }

    /**
     * 导出84 电子发票（二手车销售统一发票）列表
     */
    @PreAuthorize("@ss.hasPermi('doc:ershouchexiaoshou:export')")
    @Log(title = "84 电子发票（二手车销售统一发票）", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TInInvoice84 tInInvoice84)
    {
        List<TInInvoice84> list = tInInvoice84Service.selectTInInvoice84List(tInInvoice84);
        ExcelUtil<TInInvoice84> util = new ExcelUtil<TInInvoice84>(TInInvoice84.class);
        util.exportExcel(response, list, "84 电子发票（二手车销售统一发票）数据");
    }

    /**
     * 获取84 电子发票（二手车销售统一发票）详细信息
     */
    @PreAuthorize("@ss.hasPermi('doc:ershouchexiaoshou:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(tInInvoice84Service.selectTInInvoice84ById(id));
    }

    /**
     * 新增84 电子发票（二手车销售统一发票）
     */
    @PreAuthorize("@ss.hasPermi('doc:ershouchexiaoshou:add')")
    @Log(title = "84 电子发票（二手车销售统一发票）", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TInInvoice84 tInInvoice84)
    {
        return toAjax(tInInvoice84Service.insertTInInvoice84(tInInvoice84));
    }

    /**
     * 修改84 电子发票（二手车销售统一发票）
     */
    @PreAuthorize("@ss.hasPermi('doc:ershouchexiaoshou:edit')")
    @Log(title = "84 电子发票（二手车销售统一发票）", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TInInvoice84 tInInvoice84)
    {
        return toAjax(tInInvoice84Service.updateTInInvoice84(tInInvoice84));
    }

    /**
     * 删除84 电子发票（二手车销售统一发票）
     */
    @PreAuthorize("@ss.hasPermi('doc:ershouchexiaoshou:remove')")
    @Log(title = "84 电子发票（二手车销售统一发票）", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(tInInvoice84Service.deleteTInInvoice84ByIds(ids));
    }
}
